package boardgamer.common.client.preference;

import android.content.SharedPreferences;
import android.preference.CheckBoxPreference;

/**
* @author garysoed
*/
public class RegisteredCheckBox extends AbstractRegisteredPreference<Boolean, CheckBoxPreference> {

  RegisteredCheckBox(String key, CheckBoxPreference preference, boolean defaultValue,
      SharedPreferences sharedPreferences) {
    super(key, preference, defaultValue, sharedPreferences);
  }

  @Override
  protected Boolean getFromSharedPreferences() {
    return sharedPreferences.getBoolean(key, defaultValue);
  }

  @Override
  public void setValue(Boolean newValue) {
    preference.setChecked(newValue);
  }
}
